package com.gxz.gxzmybatis.tk.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * @author guxz4
 * @description Sku构建
 */
@Data
@Table(name = "tb_sku")
public class Sku implements Serializable {

    // 商品id
    @Id
    @Column(name = "id")
    private String id;

    // SKU名称
    @Column(name = "name")
    private String name;

    // 价格（分）
    @Column(name = "price")
    private Integer price;

    // 单位，分
    @Column(name = "seckill_price")
    private Integer seckillPrice;

    // 库存数量
    @Column(name = "num")
    private Integer num;

    // 库存预警数量
    @Column(name = "alert_num")
    private Integer alertNum;

    // 商品图片
    @Column(name = "image")
    private String image;

    // 商品图片列表
    @Column(name = "images")
    private String images;

    // 创建时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Column(name = "create_time")
    private Date createTime;

    // 更新时间

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Column(name = "update_time")
    private Date updateTime;
    // 秒杀开始时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Column(name = "seckill_begin")
    private Date seckillBegin;

    // 秒杀结束时间
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Column(name = "seckill_end")
    private Date seckillEnd;

    @Column(name = "spu_id")
    private String spuId;

    // 类目ID
    @Column(name = "category1_id")
    private Integer category1Id;

    @Column(name = "category2_id")
    private Integer category2Id;

    @Column(name = "category3_id")
    private Integer category3Id;

    @Column(name = "category1_name")
    private String category1Name;

    @Column(name = "category2_name")
    private String category2Name;

    // 类目名称
    @Column(name = "category3_name")
    private String category3Name;

    @Column(name = "brand_id")
    private Integer brandId;//

    // 品牌名称
    @Column(name = "brand_name")
    private String brandName;

    // 规格
    @Column(name = "spec")
    private String spec;

    // 销量
    @Column(name = "sale_num")
    private Integer saleNum;

    // 评论数
    @Column(name = "comment_num")
    private Integer commentNum;

    // 商品状态 1-正常，2-下架，3-删除
    @Column(name = "status")
    private String status;

    // 商品状态 1正常，2锁定
    @Column(name = "islock")
    private Integer islock;

    // 秒杀开始日期
    @Transient
    private Date startDate;

    // 秒杀开始时间
    @Transient
    private String startTimestr;

    // 持续时长
    @Transient
    private Integer len;

    // 秒杀数量
    @Column(name = "seckill_num")
    private Integer seckillNum;

    // 商品审核状态 1 已审核
    @Column(name = "audit")
    private Integer audit;

    // 限购数量
    @Column(name = "count")
    private Integer count;

    // 是否删除 1未删除，2已删除
    @Column(name = "isdel")
    private Integer isdel;

    @Transient
    private Integer points;

    @Transient
    private String bgtime;
}
